#include <stdio.h>
#include <limits.h>

int
main(void)
{
	int max1 = INT_MIN, max2 = INT_MIN, cur;

	while (scanf("%d", &cur) == 1) {
		if (cur > max1) {
			max2 = max1;
			max1 = cur;
		} else if (cur > max2) {
			max2 = cur;
		}
	}
	printf("%d %d\n", max1, max2);
	return 0;
}
